package com.jufanshare.myblog.controller.web;

import com.jufanshare.myblog.controller.admin.base.BaseController;
import com.jufanshare.myblog.entity.Article;
import com.jufanshare.myblog.service.article.ArticleService;
import com.jufanshare.myblog.service.request.RequestService;
import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 作用：首页控制器
 * 作者：Tiddler
 * 时间：2019/1/7 21：03
 * 类名： HomeController
 **/
@Controller
@RequestMapping("/")
public class HomeController extends BaseController {
    @Autowired
    private ArticleService articleService;
    /**
     * 网站首页
     * @return
     */
    @RequestMapping()
    public String home(Model model){
        PageQuery<Article> byPage = articleService.findByPage(new Article(), new PageQuery<Article>());
        model.addAttribute("page",byPage);
        return "/web/home.btl";
    }
}
